package com.wuyong.chapter5;

public class Recursive {

    public static void main(String[] args) {
        int[] arr = {1, 2,5 ,4, 5, 6};
             int sum =    sum(arr, 0);
        System.out.println("sum = [" + sum + "]");
    }

    public static  int sum(int[] arr, int l) {

        if (l == arr.length)
            return 0;
        int temp = arr[l] + sum(arr, l + 1);
        return temp;
    }
}
